<!DOCTYPE html>
<html lang="en" class="crt crt-nav-on crt-nav-type1 crt-main-nav-on crt-sidebar-on crt-layers-3">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{% block title %}{% endblock %}</title>
    <meta name="description" content="{% block description %}{% endblock %}">
    <link href="https://fonts.googleapis.com/css?family=Pacifico" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css?family=Quicksand:400,700" rel="stylesheet">
    <link href="/public/style1/fonts/icomoon/style.css" rel="stylesheet">
    <link href="/public/style1/css/plugins.min.css" rel="stylesheet">
    <link href="/public/style1/css/style.min.css" rel="stylesheet">
    {% block style_link %} {% endblock %}
    <script type="text/javascript" src="/public/style1/js/vendor/modernizr-3.3.1.min.js"></script>
    {% block top_script %} {% endblock %}
</head>

<body class="{% block body_class %}{% endblock %}">
<div class="crt-wrapper">
    <header id="crt-header">
        <div class="crt-head-inner crt-container">
            <div class="crt-container-sm">
                <div class="crt-head-row">

                    <div id="crt-head-col1" class="crt-head-col text-left">
                        <a id="crt-logo" class="crt-logo" href="/">
                         <!-------博客小图标开始
                            <img src=""
                                 alt="certy resume">------>
                            <span>南风牧下</span>
                        </a>
                    </div>

                    <!-------博客小图标结束------>
                    <div id="crt-head-col2" class="crt-head-col text-right">
                        <div class="crt-nav-container crt-container hidden-sm hidden-xs" id="login-app">
                            <nav id="crt-main-nav">
                                <ul class="clear-list">
                                    <li><a href="/">首页</a></li>
                                    <li><a href="/view/archive">归档</a>
                                    <li style="display: none;"><a href="/view/about">关于我</a></li>
                                    <li><a href="/view/contact">朋友们</a></li>

                                    <li v-if="isLogin" class="has-sub-menu">
                                        <a href="/" data-tooltip="登录">
                                            <img class="avatar avatar-42" v-bind:src="avatar" alt=""></a>
                                        <ul class="sub-menu">
                                            <li><a @click="submitLoginOut">登出</a></li>
                                        </ul>
                                    </li>
                                    <li v-if="is_not_login"><a href="/view/login">登录</a></li>
                                </ul>
                            </nav>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <nav id="crt-nav-sm" class="crt-nav hidden-lg hidden-md">
            <ul class="clear-list">
                <li><a href="/" data-tooltip="首页">
                    <span class="crt-icon crt-icon-side-bar-icon"></span>
                </a>
                </li>
                <li>
                    <a href="/view/archive" data-tooltip="归档">
                        <span class="crt-icon crt-icon-experience"></span>
                    </a>
                </li>
                <li style="display: none;">
                    <a href="/view/about" data-tooltip="关于我">
                        <span class="crt-icon crt-icon-references"></span>
                    </a>
                </li>
                <li>
                    <a href="/view/contact" data-tooltip="朋友们">
                        <span class="crt-icon crt-icon-contact"></span>
                    </a>
                </li>
                <li>
                    <a href="/view/login" data-tooltip="登录">
                        <span class="crt-icon crt-icon-qq"></span>
                    </a>
                </li>
                {% block header %}{% endblock %}
            </ul>
        </nav>
    </header>
    <div id="crt-container" class="crt-container">
        <div id="crt-nav-wrap" class="hidden-sm hidden-xs">
            <div id="crt-nav-inner">
                <div class="crt-nav-cont">
                    <div id="crt-nav-scroll">
                        <nav id="crt-nav" class="crt-nav">
                            <ul class="clear-list">
                                <li>
                                    <a href="/" data-tooltip="首页">
                                        <span class="crt-icon crt-icon-side-bar-icon"></span>
                                    </a>
                                </li>
                                <li>
                                    <a href="/view/archive" data-tooltip="归档">
                                        <span class="crt-icon crt-icon-experience"></span>
                                    </a>
                                </li>
                                <li style="display: none;">
                                    <a href="/view/about" data-tooltip="关于我">
                                        <span class="crt-icon crt-icon-contact"></span>
                                    </a>
                                </li>
                                <li>
                                    <a href="/view/contact" data-tooltip="朋友们">
                                        <span class="crt-icon crt-icon-references"></span>
                                    </a>
                                </li>
                                <li>
                                    <a href="/view/login" data-tooltip="登录">
                                        <span class="crt-icon crt-icon-qq"></span>
                                    </a>
                                </li>
                            </ul>
                        </nav>
                    </div>
                    <div id="crt-nav-tools" class="hidden">
                        <span class="crt-icon crt-icon-dots-three-horizontal"></span>
                        <button id="crt-nav-arrow" class="clear-btn">
                            <span class="crt-icon crt-icon-chevron-thin-down"></span>
                        </button>
                    </div>
                </div>
                <div class="crt-nav-btm"></div>
            </div>
        </div>
        {% block content %} {% endblock %}
    </div>
    <footer id="crt-footer" class="crt-container-lg">
        <div class="crt-container">
            <div class="crt-container-sm clear-mrg text-center">
                <p>
                    Design by KeKe
                    <a href="http://beian.miit.gov.cn" target="_blank">陕ICP备18017453号-3</a>
                </p>
            </div>
        </div><!-- .crt-container -->
    </footer>
    <!-------底部开始结束-------------------->
    <svg id="crt-bg-shape-1" class="hidden-sm hidden-xs" height="519" width="758">
        <polygon class="pol" points="0,455,693,352,173,0,92,0,0,71"/>
    </svg>
    <svg id="crt-bg-shape-2" class="hidden-sm hidden-xs" height="536" width="633">
        <polygon points="0,0,633,0,633,536"/>
    </svg>
</div><!-- .crt-wrapper --><!-- Scripts -->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.12.0.min.js"></script>
<script type="text/javascript"
        src="http://ditu.google.cn/maps/api/js?key=AIzaSyDiwY_5J2Bkv2UgSeJa4NOKl6WUezSS9XA"></script>
<script type="text/javascript" src="/public/style1/js/plugins.min.js"></script>
<script type="text/javascript" src="/public/style1/js/theme.min.js"></script>


<script src="/common/js/axios.min.js"></script>
<script src="/common/js/vue2.6.min.js"></script>
<script src="/common/js/request.js"></script>
<script src="/common/js/jquery.min.js"></script>
{% block bottom_script %}{% endblock %}

<script>
       let loginApp = new Vue({
            el: '#login-app',
            data: {
            avatar: '',
            is_admin: '',
            nick_name: '',
            uuid: '',
            isLogin : false,
            is_not_login:false
            },
            methods: {
                getLoginInfo() {
                    request({
                        url: baseUrl + "/api/login/info",
                        method: 'get',
                    }).then(res => {
                        if(res.code ==200){
                           if(JSON.stringify(res.data) == '{}'){
                           this.isLogin = false
                           this.is_not_login=true
                           }
                           else{
                             this.isLogin = true
                             this.is_not_login=false
                             this.avatar=res.data['user']['avatar']
                             this.is_admin=res.data['user']['is_admin']
                             this.nick_name=res.data['user']['nick_name']
                             this.uuid=res.data['user']['uuid']
                           }
                        }
                        else{
                           window.location.href ="/"
                        }
                    }).catch(e => {
                    alert("请求出错")
                    });
                },
             submitLoginOut(){
              request({
                url: baseUrl + "/api/login/out",
                method: 'get'
            }).then((response) => {
                if (response.code == 200) {
                    window.location.href = "/"
                }
            }).catch(function (error) {
                console.log(error);
            });
             },

            },
            created() {
                this.getLoginInfo()
            },
        });

</script>
</body>
</html>
